﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace _1.VersionAttribute
{
    class Program
    {
        [VersionAttribute("mda mda mda")]
        public static void Main(string[] args)
        {
            Type type = typeof(Program);
            var methods = type.GetMethods(                
                BindingFlags.Public | 
                BindingFlags.NonPublic | 
                BindingFlags.Static | 
                BindingFlags.Instance);            

            foreach (var method in methods)
            {
                var customAttributes = method.GetCustomAttributes(false);                                

                foreach (object o in customAttributes)
                {
                    VersionAttribute attr = o as VersionAttribute;
                    if (attr != null)
                    {                        
                        Console.WriteLine("{0} : {1}", method.Name, attr.VersionName);
                    }
                }
            }
        }

        [VersionAttribute("version 2.04 aplha", "comment")]
        public void SomeMethod()
        { 
            // ..
        }

        [VersionAttribute("version 10 beta", "comment")]
        public void SomeMethod1()
        {
            // ..
        }

        [VersionAttribute("version 3.04 aplha", "comment")]
        private void SomeMethod2()
        {
            // ..
        }
    }
}
